<!DOCTYPE html>
{% load static %}
<html lang="ru">
<head>
    <title>{% block title %}{{ settings.APP_TITLE }}{% endblock %}</title>

    {% block fonts %}
        {% include "common/fonts.html" %}
    {% endblock %}

    {% block meta %}
        {% include "common/meta.html" %}
    {% endblock %}

    <script>
        // check and set theme before render. After render the theme switch is controlled by the <theme-switcher> component
        // the component contains the same theme detection code as below. If you change this code, update the theme too
        const theme = localStorage.getItem('theme') ?? "auto";
        const currentTheme = theme === "auto" ? (matchMedia("(prefers-color-scheme: light)").matches ? "light" : "dark") : theme;
        document.documentElement.setAttribute('theme', currentTheme);
    </script>

    {% block feeds %}
        <link rel="alternate" type="application/rss+xml"
              title="Вастрик.Клуб: Новые посты"
              href="{{ settings.APP_HOST }}{% url "rss" %}" />

        <link rel="alternate" title="Вастрик.Клуб: JSON Feed"
              type="application/feed+json"
              href="{{ settings.APP_HOST }}{% url "json_feed" %}" />
    {% endblock %}

    {% block og_tags %}
        {% include "common/og.html" %}
    {% endblock %}

    {% include "common/favicon.html" %}
    {% include "common/css.html" %}
    {% block css %}{% endblock %}
</head>
<body>

{% block body %}
    <main id="app">
        {% block menu %}
            {% if me %}
                {% include "common/menu-full.html" %}
            {% else %}
                {% include "common/menu-simplified.html" %}
            {% endif %}
        {% endblock %}
        {% block content %}
        {% endblock %}
    </main>
{% endblock %}

{% block footer %}
    <footer class="footer" id="footer">
        <div class="footer-left">
            <a href="{% url "show_post" "docs" "about" %}">О Клубе</a> &nbsp;&middot;&nbsp;

            <a href="{{ settings.VALUES_GUIDE_URL }}">Наши ценности</a> &nbsp;&middot;&nbsp;

            <a href="{% url "crew" %}">Команда</a> &nbsp;&middot;&nbsp;

            <a href="{% url "show_post" "docs" "privacy_policy" %}">Политика приватности</a> &nbsp;&middot;&nbsp;

            <a href="{% url "show_post" "docs" "contact" %}">Связаться с нами</a>

            <br><br>

            {% if request.me %}
                <a href="{% url "invites" %}">Пригласить друга</a> &nbsp;&middot;&nbsp;
            {% endif %}

            <a href="https://github.com/vas3k/vas3k.club">Опенсорс</a> &nbsp;&middot;&nbsp;

            <a href="{% url "show_post" "docs" "blocked_dolor" %}">Оплата из России</a>

            <br><br>

            CC BY-SA
        </div>
        <div class="footer-right">
            <theme-switcher></theme-switcher>

            {% if me %}
                <form method="POST" action="{% url "logout" %}" class="footer-logout">
                    {% csrf_token %}
                    <button type="submit" class="footer-logout-button">Выйти&nbsp;<i class="fas fa-sign-out-alt"></i></button>
                </form>
            {% endif %}
        </div>
    </footer>
{% endblock %}

{% include "common/js.html" %}
{% block js %}{% endblock %}
</body>
</html>
